print('='*30,'第一章作业1','='*30)
print()

print('='*30,'while循环输出九九乘法表1','='*30)
i = 1
while i<= 9:
    j = 1
    while j <= i:
        sum = j*i
        print("%dx%d=%d"%(j,i,sum),end=("\t"))
        j += 1
    print()
    i += 1

print('='*30,'while循环输出九九乘法表2','='*30)
i = 9
while i >= 1:
    j = 1
    while j<=i:
        print("%dx%d=%d"%(j,i,j*i),end=("\t"))
        j += 1
    print()
    i -= 1

print('='*30,'while循环输出九九乘法表3','='*30)
i = 1
while i<=9:
    k = 1
    while k <= 9-i:
        print('     ',end="\t")
        k += 1
    j = 1
    while j<=i:
        print("%dx%d=%d"%(j,i,j*i),end=("\t"))
        j += 1
    print()
    i +=1

print('='*30,'while循环输出九九乘法表4','='*30)
i = 9
while i>=1:
    k = 1
    while k <= 9-i:
        print('     ',end="\t")
        k += 1
    j = 1
    while j<=i:
        print("%dx%d=%2d"%(j,i,j*i),end=("\t"))
        j += 1
    print()
    i -=1

print('='*30,'for循环输出九九乘法表1','='*30)
for row in range(1,10):
    for col in range(1,row+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print()

print('='*30,'for循环输出九九乘法表2','='*30)
for row in range(9,0,-1):
    for col in range(1,row+1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print()

print('='*30,'for循环输出九九乘法表3','='*30)
for col in range(9,0,-1):
    for i in range(0,col-1):
        print(end="         ")
    for row in range(9,col-1,-1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print()

print('='*30,'for循环输出九九乘法表4','='*30)
for row in range(9,0,-1):
    for i in range(9,row,-1):
        print(end="         ")
    for col in range(row,0,-1):
        print('{}*{}={:<4}'.format(row,col,row*col),end=' ')
    print()